package com.example.sample.util;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * Created by LiangYu on 2017/7/24.
 */
public class ExceptionUtil {

    public static String getErrorInfoFromException(Throwable e) {
        final String sep = "";
        try {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            return sep + sw.toString() + sep;
        } catch (Exception e2) {
            return "bad getErrorInfoFromException";
        }
    }
}
